package org.framework.lazy.cloud.network.heartbeat.client.netty.permeate.udp.advanced;

import lombok.extern.slf4j.Slf4j;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyChannelContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.payload.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.permeate.udp.client.AbstractHandleUdpDistributeStagingOpenedTypeAdvanced;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;

/**
 * 服务端下发暂存开启消息处理
 */
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Slf4j
public class ClientHandleUdpDistributeStagingOpenedTypeAdvanced extends AbstractHandleUdpDistributeStagingOpenedTypeAdvanced<NettyProxyMsg> {


    public ClientHandleUdpDistributeStagingOpenedTypeAdvanced() {

    }

    /**
     * 处理当前数据
     *
     * @param nettyChannelContext 当前通道
     * @param msg     通道数据
     */
    @Override
    protected void doHandler(NettyChannelContext nettyChannelContext, NettyProxyMsg msg) {
        String clientId = new String(msg.getClientId());
        //客户端：{}离线暂存开启
        log.warn("Client: {} Offline temporary storage enabled", new String(msg.getClientId()));
        // 修改redis 客户端暂存状态
//        String stagingStatusKey = StagingConfigKeyConstant.getStagingStatusKey(clientId);
//        stringRedisTemplate.opsForValue().set(stagingStatusKey, StagingStatus.OPENED.name());
    }
}
